#pragma once 

#include "Product.h"
/* the framework of implement objects */
namespace Framework
{
    // an abstract class that implement `create` method
    class Factory
    {
    protected:
        // abstract functions need to be implement by derived class
        virtual void registerProduct(Product& product)
        {
            std::cout << "Factory: this product don't need to be registered" << std::endl;
        }
        virtual Product* createProduct(char* owner) = 0;

    public:
        // template method
        Product* create(char* owner)
        {
            Product* p_product = createProduct(owner);
            registerProduct(*p_product);
            return p_product;
        }
    };
};